Monitor_Weapon_Drop()
{
	self endon("disconnect");
	self endon("killed_player");

	if (!level.allow_secondarydrop)
		return;

	while (1)
	{
		timer = 0;
		primary = self getWeaponSlotWeapon("primary");
		primaryb = self getWeaponSlotWeapon("primaryb");
		current = self getcurrentweapon();

		while (self UseButtonPressed() && isDefined(primary) && isDefined(primaryb) && primaryb == current && !self.bombinteraction)
		{
			timer = timer + .1;

			if (timer > 1.6)
			{
				self dropItem(self getcurrentweapon());

				primary = self getWeaponSlotWeapon("primary");
				if (isDefined(primary) && primary != "none")
					self switchToWeapon(primary);
			}

			wait level.frame * 2;
			current = self getcurrentweapon();
		}

		wait level.fps_multiplier * .5;
	}
}

Weapon_Switch_Monitor_Setup()
{
	level.weapondeletes = [];
	i=0;

	if (!level.allow_sniperdrops)
	{
		if( game["allies"] == "american" && level.weapons["springfield_mp"].limit > 0 && getcvarint("scr_allow_springfield") )
		{
			level.weapondeletes[i] = "springfield_mp";
			i++;
		}
		else if( game["allies"] == "british" && level.weapons["enfield_scope_mp"].limit > 0 && getcvarint("scr_allow_enfieldsniper") )
		{
			level.weapondeletes[i] = "enfield_scope_mp";
			i++;
		}
		else if( game["allies"] == "russian" && level.weapons["mosin_nagant_sniper_mp"].limit > 0 && getcvarint("scr_allow_nagantsniper") )
		{
			level.weapondeletes[i] = "mosin_nagant_sniper_mp";
			i++;
		}

		if( getcvarint("scr_allow_kar98ksniper") && level.weapons["kar98k_sniper_mp"].limit > 0 )
		{
			level.weapondeletes[i] = "kar98k_sniper_mp";
			i++;
		}
	}

	if ( !level.allow_shotgundrops || !level.allow_autodrops )
	{
		for(weaponname = 0; weaponname < level.weaponnames.size; weaponname++)
		{
			name = level.weaponnames[weaponname];
			
			// IF ITS NOT A SHOTGUN OR AUTO SKIP
			if(level.weapons[name].classname != "mg" && level.weapons[name].classname != "smg" && level.weapons[name].classname != "shotgun" )	
				continue;
			
			// IF ITS AN AUTO AND AUTO DROPS IS ON SKIP
			if( (level.weapons[name].classname == "mg" || level.weapons[name].classname == "smg") && level.allow_autodrops)
				continue;
			
			// IF ITS A SHOTGUN AND SHOTGUN DROPS IS ON SKIP
			if(level.weapons[name].classname == "shotgun" && level.allow_shotgundrops)
				continue;
			
			if(level.weapons[name].limit > 0 && getcvarint(level.weapons[name].server_allowcvar) == 1) 
			{
				level.weapondeletes[i] = name;
				i++;
			}
		}
	}

	if (i)
		level thread Delete_Swapped_Weapons();
}

Delete_Swapped_Weapons()
{
	while (1)
	{
		wait level.fps_multiplier * .25;

		for (i=0 ; i<level.weapondeletes.size ; i++)
		{
			deletePlacedEntity(level.weapondeletes[i]);
		}

	}
}

deletePlacedEntity(entity)
{
	entities = getentarray(entity, "classname");
	for(i = 0; i < entities.size; i++)
		entities[i] delete();
}